package view;

import java.util.ArrayList;

import org.eclipse.swt.SWT;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

import terms.Node;

public class MainWindow {

	ArrayList<Node> nodes;
	private Shell shell;

	public static void main(String[] args) {
		new MainWindow().run();
	}

	public void run() {
		Display display = new Display();
		shell = new Shell(display);
		shell.setText("Transfer function solver");
		createContents();
		shell.open();
		while (! shell.isDisposed())
			if (! display.readAndDispatch())
				display.sleep();
		display.dispose();
	}

	private void createContents() {
		shell.setLayout(new FormLayout());
		Canvas canvas = new Canvas(shell, SWT.DOUBLE_BUFFERED);
		FormData formData = new FormData();
		formData.left = new FormAttachment(0, 0);
		formData.top = new FormAttachment(0, 0);
		formData.right = new FormAttachment(100, 0);
		formData.bottom = new FormAttachment(100, 0);
		canvas.setLayoutData(formData);
		canvas.addPaintListener(new PaintListener(){
			@Override
			public void paintControl(PaintEvent e) {
				
			}});
	}
}
